from selenium import webdriver
from selenium.webdriver.common.by import By
from basePage import BasePage

class LoginPage(BasePage):
    username_input_loc = (By.ID,"username")
    password_input_loc = (By.ID,"password")
    login_button_loc   = (By.CSS_SELECTOR,".login_btn.fl")
    url = "/index.php?m=user&c=public&a=login"

    def input_username(self):
        self.find_element(self.username_input_loc).send_keys("weiguozhen")

    def input_password(self):
        self.find_element(self.password_input_loc).send_keys("123123")

    def click_login_button(self):
        self.find_element(self.login_button_loc).click()

    def login(self):
        self.open()
        self.input_username()
        self.input_password()
        self.click_login_button()

